﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Interfaces;
using System.Windows;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using System.Windows.Data;
using GA.Server.DatabaseManager;
using GA.Shared.Objects;

namespace GA.Server.Objects
{
    public class DatabaseProject : DatabaseObject
    {
        /// <summary>
        /// Identifies the Id Property.
        /// </summary>
        public static readonly DependencyProperty IdProperty =
            DependencyProperty.Register(
                "Id",
                typeof(int),
                typeof(DatabaseProject),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the ProjectTypeId Property.
        /// </summary>
        public static readonly DependencyProperty ProjectTypeIdProperty =
            DependencyProperty.Register(
                "ProjectTypeId",
                typeof(int),
                typeof(DatabaseProject),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the ProjectType Property.
        /// </summary>
        public static readonly DependencyProperty ProjectTypeProperty =
            DependencyProperty.Register(
                "ProjectType",
                typeof(ProjectType),
                typeof(DatabaseProject),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the FacilityId Property.
        /// </summary>
        public static readonly DependencyProperty FacilityIdProperty =
            DependencyProperty.Register(
                "FacilityId",
                typeof(int),
                typeof(DatabaseProject),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Facility Property.
        /// </summary>
        public static readonly DependencyProperty FacilityProperty =
            DependencyProperty.Register(
                "Facility",
                typeof(Facility),
                typeof(DatabaseProject),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the WorkCompleted Property.
        /// </summary>
        public static readonly DependencyProperty WorkCompletedProperty =
            DependencyProperty.Register(
                "WorkCompleted",
                typeof(int),
                typeof(DatabaseProject),
                new PropertyMetadata(0));

        /// <summary>
        /// Gets or sets the Id.
        /// </summary>
        
        [DatabaseField("Id", IsKey = true, IsIdentity = true)]
        public int Id
        {
            get { return (int)SafeGetValue(IdProperty); }
            set { SafeSetValue(IdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the ProjectType Id.
        /// </summary>
        
        [DatabaseField("ProjectTypeId", IsKey = true)]
        public int ProjectTypeId
        {
            get { return (int)SafeGetValue(ProjectTypeIdProperty); }
            set { SafeSetValue(ProjectTypeIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the ProjectType.
        /// </summary>
        
        public ProjectType ProjectType
        {
            get { return (ProjectType)SafeGetValue(ProjectTypeProperty); }
            set { SafeSetValue(ProjectTypeProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Facility Id.
        /// </summary>
        
        [DatabaseField("FacilityId", IsKey = true)]
        public int FacilityId
        {
            get { return (int)SafeGetValue(FacilityIdProperty); }
            set { SafeSetValue(FacilityIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Facility.
        /// </summary>
        
        public Facility Facility
        {
            get { return (Facility)SafeGetValue(FacilityProperty); }
            set { SafeSetValue(FacilityProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Work Completed amount.
        /// </summary>
        
        [DatabaseField("WorkCompleted")]
        public int WorkCompleted
        {
            get { return (int)SafeGetValue(WorkCompletedProperty); }
            set { SafeSetValue(WorkCompletedProperty, value); }
        }

        public DatabaseProject()
        {
        }

        public DatabaseProject(LinkedDependencyObject baseObject)
            : base(baseObject)
        {
        }

        public DatabaseProject(LinkedDependencyObject baseObject, BindingMode bindingMode)
            : base(baseObject, bindingMode)
        {
        }

        public override void LoadAllPropertyObjects()
        {
            #warning Not Implemented
        }

        public override void LoadPropertyObject(string propertyName)
        {
            #warning Not Implemented
        }
    }
}
